package com.sw.small_world.fragment.me;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.sw.small_world.R;
import com.sw.small_world.activity.MainActivity;
import com.sw.small_world.fragment.base.BaseFragment;
import com.sw.small_world.utils.ConstantUtils;
import com.sw.small_world.utils.StartUtils;
import com.sw.small_world.utils.ToastUtil;
import com.sw.small_world.widgets.MeItemRelativeLayout;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/3/16.
 */

public class MeFragment extends BaseFragment {


    @Bind(R.id.iv_portrait)
    ImageView ivPortrait;
    @Bind(R.id.tv_name)
    TextView tvName;
    @Bind(R.id.see_more_info)
    TextView seeMoreInfo;
    @Bind(R.id.rl_my_info)
    RelativeLayout rlMyInfo;
    @Bind(R.id.item_my_friends)
    MeItemRelativeLayout itemMyFriends;
    @Bind(R.id.item_my_circle)
    MeItemRelativeLayout itemMyCircle;
    @Bind(R.id.item_my_collection)
    MeItemRelativeLayout itemMyCollection;
    @Bind(R.id.item_my_ask)
    MeItemRelativeLayout itemMyAsk;
    @Bind(R.id.item_my_answer)
    MeItemRelativeLayout itemMyAnswer;
    @Bind(R.id.item_my_person_doing)
    MeItemRelativeLayout itemMyPersonDoing;
    @Bind(R.id.item_my_small_message)
    MeItemRelativeLayout itemMySmallMessage;
    @Bind(R.id.item_integral_center)
    MeItemRelativeLayout itemIntegralCenter;
    @Bind(R.id.item_settings)
    MeItemRelativeLayout itemSettings;
    @Bind(R.id.exit_app)
    TextView exitApp;
    private MainActivity activity;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        activity = (MainActivity) getActivity();
    }

    @Override
    protected Object requestData() {
        return ConstantUtils.STATE_SUCCESSED;
    }

    @Override
    protected View getSuccessView() {
        View view = View.inflate(activity, R.layout.fragment_me, null);
        ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @OnClick({R.id.rl_my_info, R.id.item_my_friends, R.id.item_my_circle, R.id.item_my_collection, R.id.item_my_ask, R.id.item_my_answer, R.id.item_my_person_doing, R.id.item_my_small_message, R.id.item_integral_center, R.id.item_settings, R.id.exit_app})
    public void onClick(View view) {
        if (view.getId() == R.id.exit_app) {
            ToastUtil.show("退出登录");
        } else {
            StartUtils.startActivityById(activity, view.getId());
        }
    }
}
